Skip to content

[OpenAL] Fix sourceSeek crash on stopped sources - #27426

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:openal_fix
Jul 29, 2026
Merged

[OpenAL] Fix sourceSeek crash on stopped sources#27426
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:openal_fix

Conversation

@sbc100

@sbc100 sbc100 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Fix a crash in sourceSeek when called on a stopped source by resetting bufsProcessed = 0 before evaluating buffer durations.

This replaces #26770. Unlike #26770, which added a top-level check on src.bufQueue[0], this change handles zero/dummy buffers and empty queues safely anywhere in bufQueue via for .. of iteration and audioBuf?.duration ?? 0.0. It also adds assertions to test_openal_error.c to verify state correctness after seeking.

See: #26770

@sbc100
sbc100 requested a review from kripken July 28, 2026 04:41
@sbc100 sbc100 changed the title [openal] Fix sourceSeek crash on stopped sources [OpenAL] Fix sourceSeek crash on stopped sources Jul 28, 2026
Comment thread src/lib/libopenal.js
Comment thread src/lib/libopenal.js Outdated
Fix a crash in `sourceSeek` when called on a stopped source by resetting
`bufsProcessed = 0` before evaluating buffer durations.

This replaces emscripten-core#26770. Unlike emscripten-core#26770, which added a top-level check on
`src.bufQueue[0]`, this change handles zero/dummy buffers and empty
queues safely anywhere in `bufQueue` via `for .. of` iteration and
`audioBuf?.duration ?? 0.0`. It also adds assertions to
`test_openal_error.c` to verify state correctness after seeking.

See: emscripten-core#26770
@sbc100
sbc100 merged commit 86ea17d into emscripten-core:main Jul 29, 2026
20 of 23 checks passed
@sbc100
sbc100 deleted the openal_fix branch July 29, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants